﻿using JsonTest;
using Newtonsoft.Json;

try
{
    var o = new E_Complex();

    //DateTime t = DateTime.Now;
    //o.D.C.Add(new E_Simple(), "added");

    //o.D.S.Add("03", new E_Simple() { P_Int = 6 });
    //o.C.Collect.Add(new E_Simple() { P_Int = 5 });

    var options = new JsonSerializerSettings() { Formatting = Formatting.Indented };
    options.Converters.Add(new JsonColorConverter());
    options.Converters.Add(new JsonDatetimeConverter());
    options.Converters.Add(JsonDictConverter.Gen(o.D.C));

    var str = JsonConvert.SerializeObject(o, options);
    Console.Write(str);
    Console.WriteLine();

    var n = JsonConvert.DeserializeObject<E_Complex>(str, options);
}
catch(Exception e)
{
    Console.WriteLine(e.Message);
    Console.WriteLine(e.StackTrace);
}
Console.ReadLine();


